<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >

    <ui:composition template="layout.xhtml">

        <ui:define name="corpo">

            <h:form id="tiposelo_form" acceptcharset="utf-8">
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}" value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('config.xhtml')}" value="Configurações" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('indexTipoSelo.xhtml')}" value="Tipo Selo" update="@form" immediate="true"/> >
                    <p:commandLink  value="Cadastrar Tipo Selo" update="@form" immediate="true"/>
                </div>
                <p:panel header="Cadastrar Tipo Selo">
                    <p:messages id="msg"/>
                    <fieldset>
                        <legend>Dados Tipo do Selo</legend>
                        <h:panelGrid columns="2"  border="0" styleClass="textAlignRight" columnClasses="textAlignRight"> 
                            <h:outputLabel value="Nome: "/>
                            <p:inputText value="#{managerTipoSelo.tipoSelo.nome}"
                                         id="nome_tiposelo"
                                         required="true" size="50" 
                                         requiredMessage="O campo nome deve ser preenchido "/>

                            <h:outputLabel value="Descricao: "/>
                            <p:inputTextarea value="#{managerTipoSelo.tipoSelo.descricao}"
                                             id="descricao_tiposelo"
                                             required="true" cols="50" 
                                             requiredMessage="O campo descrição deve ser preenchido "

                                             />

                            <h:outputLabel value="Cores: "/>
                            <p:selectOneMenu id="listcores"  value="#{managerTipoSelo.tipoSelo.corSelo}" converter="corConverter"     
                                             label="Selecione a cor do Selo" var="p" style="width: 300px">  
                                <f:selectItems value="#{managerVisaoCorSelo.todos()}" var="seloCor" itemLabel="#{seloCor.descricao}"  />                   

                                <p:column >  
                                    <table>
                                        <tr  style="height:30px; background-color: \##{p.cor};">
                                            <td style="width: 20px;"></td>
                                        </tr>
                                    </table>
                                </p:column>
                                <p:column>  
                                    #{p.descricao}
                                </p:column>  
                            </p:selectOneMenu> 


                            <h:outputLabel value=" "/>
                            <p:row>
                                <h:outputText value="Gratuidade: "/>
                                <h:selectBooleanCheckbox label="Gratuidade" value="#{managerTipoSelo.tipoSelo.gratuidade}"/> 
                                <h:outputText value="Arquivamento: "/>
                                <h:selectBooleanCheckbox label="Arquivamento" value="#{managerTipoSelo.tipoSelo.arquivamento}"/> 
                            </p:row>

                        </h:panelGrid>

                    </fieldset>
                    <br/>
                    <div class="buttonAction">
                        <p:commandButton id="id_submit"  icon="ui-icon-disk" value="Salvar" actionListener="#{managerTipoSelo.salvar()}" update="@form" />
                        <p:commandButton id="cancelar" icon="ui-icon-arrowreturnthick-1-w" value="Cancelar" actionListener="#{managerVisualizarTipoSelo.redirect('indexTipoSelo.xhtml')}" immediate="true" />  
                    </div>
                </p:panel>   
                <p:ajaxStatus style="width:16px;height:16px;" id="ajaxStatusPanel">  
                    <f:facet name="start">  
                        <h:graphicImage value="/media/img/loading.gif" />  
                    </f:facet>  

                    <f:facet name="complete">  
                        <h:outputText value="" />  
                    </f:facet>  
                </p:ajaxStatus>




            </h:form>  

        </ui:define>


    </ui:composition> 

</html>